package com.example.onlineanswer.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.onlineanswer.model.entity.QuestionOption;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 题目选项Mapper接口
 */
@Mapper
public interface QuestionOptionMapper extends BaseMapper<QuestionOption> {

    /**
     * 根据题目ID获取选项列表
     *
     * @param questionId 题目ID
     * @return 选项列表
     */
    @Select("SELECT id, question_id, option_content, option_order, is_correct as correct, create_time, update_time FROM question_option WHERE question_id = #{questionId} ORDER BY option_order")
    List<QuestionOption> getOptionsByQuestionId(@Param("questionId") Long questionId);
} 